package vista;

import java.util.HashMap;

import modelo.AeroNave;

public class VistaAeroNaveFactory {
	@SuppressWarnings("rawtypes")
	private HashMap<String, Class> mapa;

	@SuppressWarnings("rawtypes")
	public VistaAeroNaveFactory() {

		this.mapa = new HashMap<String, Class>();
		this.mapa.put("modelo.AvionSimple", VistaAvion.class);
		this.mapa.put("modelo.AvionPesado", VistaAvionPesado.class);
		this.mapa.put("modelo.AvionComputarizado",
				VistaAvionComputarizado.class);
		this.mapa.put("modelo.Helicoptero", VistaHelicoptero.class);
	}

	public VistaAeronave getVista(AeroNave avion) {

		try {
			return (VistaAeronave) (this.mapa.get(avion.getClass().getName()))
					.newInstance();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;

	}
}
